import React, { Component } from 'react'
import { connect } from 'react-redux'
import { View, Button, Text, Icon, } from '@tarojs/components'
import { add, minus, asyncAdd } from '../../actions/counter'
import Taro from '@tarojs/taro'
import './index.less'

type PageStateProps = {
  counter: {
    num: number
  }
}

type PageDispatchProps = {
  add: () => void
  dec: () => void
  asyncAdd: () => any
}

type PageOwnProps = {}

type PageState = {}

type IProps = PageStateProps & PageDispatchProps & PageOwnProps

interface Index {
  props: IProps;
}

@connect(({ counter }) => ({
  counter
}), (dispatch) => ({
  add() {
    dispatch(add())
  },
  dec() {
    dispatch(minus())
  },
  asyncAdd() {
    dispatch(asyncAdd())
  }
}))
class Index extends Component {
  componentWillReceiveProps(nextProps) {
    console.log(this.props, nextProps)
  }

  componentWillUnmount() { }

  componentDidShow() { 
    Taro.setTabBarStyle({
      backgroundColor: "#000539",
      color: '#808184'
    })
  }

  componentDidHide() {
    Taro.setTabBarStyle({
      backgroundColor: "#fff",
      color: '#9E9E9E'
    })
   }

  render() {
    return (
      <View className='index'>
        <View className="Serach-container">
          <View className='Serach'>
            <Icon size='23' className='icon' type='search' />
            <View className='text'>人名、企业名、品牌、事件关键词</View>

          </View>
          <View className='btn'>搜索</View>
        </View>
      </View>
    )
  }
}

export default Index

